#!/usr/bin/python

import sys
sys.path.append('../')

from onmslib import *

#dict = {'id' : 'foreignid1', 'label' : 'host1', 'group' : 'TWiO'}
dict = {'id' : 'foreignid1', 'label' : 'host1', 'group' : 'TWiO'}
dict.update(BASEARGS)

def add_group():

	group = Group(**dict)
	group.commit('add')
	return group

def add_node():

	node = Node(**dict)
	node.commit('add')

	return node

def set_node_attr(node):

	node.add_key('building', 'Somewhere, USA')
	node.commit('set')

def remove_node(node):

	node.commit('remove')

def add_interface(node):

	iface = Interface(node=node, ip='192.168.1.1')
	iface.commit('add')

	return iface

def set_interface_attr(iface):
	iface.add_key('desc' , 'eth0')
	iface.add_key('snmp-primary' , 'P')
	iface.commit('set')

def add_service(iface):
	service = Service(service='ICMP', interface=iface)
	service.commit('add')

def remove_service(iface):
	service = Service(service='ICMP', interface=iface)
	service.commit('remove')

if __name__=="__main__":

	group = add_group()
	node = add_node()
	set_node_attr(node)
	iface = add_interface(node)
	set_interface_attr(iface)
	add_service(iface)

